<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:cc="http://java.sun.com/jsf/composite"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <!-- INTERFACE -->
    <cc:interface>
        <cc:attribute name="professional"/>&nbsp;
    </cc:interface>

    <!-- IMPLEMENTATION -->
    <cc:implementation>
        <p:dataTable id="#{cc.id}" value="#{bookKeepingSummery.bookKeepingSummeryRows}" var="sr">
            <f:facet name="header">
                <p:outputLabel value="#{sessionController.institution.name}"/> &nbsp;<h:outputLabel/>
                    <p:outputLabel value="Book Keeping Summary "/><h:outputLabel/>   
                    <h:outputLabel/><h:outputLabel/>
                    <h:outputLabel value="  From : "  />
                    <h:outputLabel  value="#{bookKeepingSummery.fromDate}" >
                        <f:convertDateTime pattern="dd MM yy HH:mm:ss "/>
                    </h:outputLabel>
                    <h:outputLabel value="  To : "/> 
                    <h:outputLabel  value="#{bookKeepingSummery.toDate}">
                        <f:convertDateTime pattern="dd MM yy HH:mm:ss "/>
                    </h:outputLabel>
                    <h:outputLabel value=""><br/>
                    </h:outputLabel>
                    <h:outputLabel value="OPD Service"/>     
                </f:facet>
            <p:column  headerText="Category" >
                <f:facet name="header">
                    <p:outputLabel value="Category"/>
              </f:facet>
                <p:outputLabel value="#{sr.categoryName}" rendered="#{sr.catRow}" ></p:outputLabel>
            </p:column>
            <p:column headerText="Item/Service" >
                 <f:facet name="header">
                    <p:outputLabel value="Item/Service" />
              </f:facet>
                <p:outputLabel value="#{sr.itemName}"/> 
            </p:column>
            <p:column headerText="Count" >
                 <f:facet name="header">
                    <p:outputLabel value="Count" />
              </f:facet>
                <p:outputLabel value=" #{sr.catCount}" rendered="#{!sr.catRow and !sr.totalRow}" ></p:outputLabel>

            </p:column>
            <p:column headerText="Hospital Fee" styleClass="numberCol" >
                <f:facet name="header">
                    <p:outputLabel value="Hospital Fee" />
              </f:facet>
                <p:outputLabel value="#{sr.hosFee}" rendered="#{!sr.catRow and sr.totalRow eq false}" >
                    <f:convertNumber pattern="#,##0.00" ></f:convertNumber>
                </p:outputLabel>
                <p:outputLabel value="#{sr.hosFee}" style="font-weight: bold;" rendered="#{!sr.catRow and sr.totalRow eq true}" >
                    <f:convertNumber pattern="#,##0.00" ></f:convertNumber>
                </p:outputLabel>
              
                <f:facet name="footer" rendered="#{cc.attrs.professional eq false}">
                    <h:outputLabel value="#{bookKeepingSummery.opdHospitalTotal}">
                        <f:convertNumber pattern="#,##0.00"/>
                    </h:outputLabel>
                </f:facet>
            
            </p:column>
            <p:column headerText="Professional Fee"  styleClass="numberCol" rendered="#{cc.attrs.professional eq true}" >
                <p:outputLabel value="&lt;b&gt;" rendered="#{sr.totalRow}" escape="false" ></p:outputLabel>
                <p:outputLabel value="#{sr.proFee}" rendered="#{!sr.catRow}" >
                    <f:convertNumber pattern="#,##0.00" ></f:convertNumber>
                </p:outputLabel>
                <p:outputLabel value="&lt;b&#47;&gt;" rendered="#{sr.totalRow}"  escape="false"  ></p:outputLabel>
            </p:column>
            <p:column  headerText="Total Fee"  styleClass="numberCol" rendered="#{cc.attrs.professional eq true}">
                <p:outputLabel value="&lt;b&gt;" rendered="#{sr.totalRow}" escape="false" />
                <p:outputLabel value="#{sr.hosFee+sr.proFee}" rendered="#{!sr.catRow}" >
                    <f:convertNumber pattern="#,##0.00" ></f:convertNumber>
                </p:outputLabel>
                <p:outputLabel value="&lt;b&#47;&gt;" rendered="#{sr.totalRow}"  escape="false"  ></p:outputLabel>
                <f:facet name="footer">
                    <h:outputLabel value="#{bookKeepingSummery.opdHospitalTotal}">
                        <f:convertNumber pattern="#,##0.00"/>
                    </h:outputLabel>
                </f:facet>
            </p:column>
        </p:dataTable>
    </cc:implementation>
</html>